<?php

	class Default_Form_Contact extends Zend_Form
	{
		private $_action;
		
		public function __construct($action)
		{
			$this->_action = $action;
			parent::__construct();
		}
		
		public function init()
		{
			$this->setAction($this->_action);
			$this->setMethod('post');
			$this->setAttrib('class','form');
			
			$email	= new Zend_Form_Element_Text('email');
			$email	->setLabel(Zend_Registry::get('translate')->_('YOUR_EMAIL').':')
				 	->setRequired(true)
				 	->addValidator('NotEmpty', true)
				 	->addValidator('regex', true, array(Default_Model_Validator::getEmailExp()))
					->addErrorMessage('*');
				 
			$subject	= new Zend_Form_Element_Text('subject');
			$subject	->setLabel(Zend_Registry::get('translate')->_('SUBJECT').':')
				 		->setRequired(true)
				 		->addValidator('NotEmpty', true)
						//->addValidator('regex', false, array(Default_Model_Validator::getEmailSubjectExp()))
						->addErrorMessage('*');
						
			$message	= new Zend_Form_Element_Textarea('message');
			$message	->setLabel(Zend_Registry::get('translate')->_('MESSAGE').':')
				 		->setRequired(true)
				 		->addValidator('NotEmpty', true)
						//->addValidator('regex', false, array(Default_Model_Validator::getEmailMessageExp()))
						->addErrorMessage('*');
						
			$captcha = new Zend_Form_Element_Captcha('captcha', array(
			    'label' => Zend_Registry::get('translate')->_('CAPTCHA'),
			    'captcha' => 'Image',
			    'captchaOptions' => array(
			        'wordLen' => 6,
			        'timeout' => 300,
					'font'		=> 'fonts/arial.ttf',
					'imgDir'	=> 'pics/captcha',
					'imgUrl'	=> 'http://spagooy.com/pics/captcha',
					'height'	=> '60px',
					'width'		=> '140px'
			    )
			));
			$captcha->addErrorMessage('*');
			
			$submit = new Zend_Form_Element_Submit('submit');
			$submit->setLabel(Zend_Registry::get('translate')->_('SEND'));			
			
			$elements = array($email,$subject,$message,$captcha,$submit);
				
			$this->addElements($elements);
			
			
			  
			$this->setDisableLoadDefaultDecorators(true);
			
			$this->addDecorator('FormElements')
				 ->addDecorator('HtmlTag',array('tag' => 'ul'))
				 ->addDecorator('Form');
 
			$this->setElementDecorators(array(
				'ViewHelper',
				'Errors',
				'Label',
				new Zend_Form_Decorator_HtmlTag(array('tag' => 'li'))				
			));
		
			$submit->removeDecorator('Label');
			$captcha->removeDecorator('ViewHelper');
			$captcha->setDecorators(array(
				'Errors',
				'Label',
				new Zend_Form_Decorator_HtmlTag(array('tag' => 'li', 'class' => 'captcha'))				
			));	
		}
	}